/**
 * @param {string} columnTitle
 * @return {number}
*/
var titleToNumber = function(columnTitle) {
  let result = 0;
  for(let i = 0; i < columnTitle.length; i++) {
    result = result * 26 + columnTitle[i].charCodeAt() - 65 + 1;
  }
  return result;
};
let columnTitle = "A";
console.log(titleToNumber(columnTitle));
columnTitle = "AB";
console.log(titleToNumber(columnTitle));
columnTitle = "ZY";
console.log(titleToNumber(columnTitle));
